attribute vec4 vPos;			//Vertex Position
attribute vec3 vNor;			//Vertex Normal

uniform mat4 modelView;			//ModelView Matrix
uniform mat4 perspective;		//Perspective Matrix
uniform mat3 normalMatrix;		//Normal Matrix, ie Inv-Transpose of ModelView Matrix
uniform vec4 lightPos;	//LightPosition in eyespace(transformed to eyespace on CPU)

//varying vec3 eyeSpaceNormal;
varying vec3 objectNormal;
//varying vec3 lightDir;
varying vec3 uvPos;


void main(void)
{    
	objectNormal = vNor;
	vec3 eyeSpaceNormal = normalMatrix * vNor;	//Transform normals by modelview matrix(normalmatrix) 
	vec4 rawPos = modelView * vPos;			//vertex eyespace position
	//lightDir = vec3(lightPos - rawPos);
	
	gl_Position = perspective * rawPos;		//perform perspective divide
	uvPos.xy = (gl_Position.xy + 1.0)/2.0;	//These UV Coords will be saved in buffer 
	uvPos.z = eyeSpaceNormal.z;				//We store front/back facing in the z coordinate
	
}

